package com.renbang.dao.sqlsession;

import org.springframework.stereotype.Repository;


@Repository("DaoImp")
public class DaoImp {
	/*@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;
	
	public int batchSave(String str, List objs )throws Exception{
		return sqlSessionTemplate.insert(str, objs);
		
	}
	
	*//**
	 * 修改对象
	 * @param str
	 * @param obj
	 * @return
	 * @throws Exception
	 *//*
	public int update(String str, Object obj) throws Exception {
		return sqlSessionTemplate.update(str, obj);
	}

	*//**
	 * 批量插入
	 * @param str
	 * @param list
	 * @return
	 * @throws Exception
	 *//*
	public void batchUpdate(String str, List objs )throws Exception{
		SqlSessionFactory sqlSessionFactory = sqlSessionTemplate.getSqlSessionFactory();
		SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false);
		try{
			if(objs!=null){
				for(int i=0,size=objs.size();i<size;i++){
					sqlSession.update(str, objs.get(i));
				}
				sqlSession.flushStatements();
				sqlSession.commit();
				sqlSession.clearCache();
			}
		}finally{
			sqlSession.close();
		}
	}
	
	*//**
	 * 删除多个
	 * @param str
	 * @param obj
	 * @return
	 * @throws Exception
	 *//*
	public int batchDelete(String str, List objs )throws Exception{
		return sqlSessionTemplate.delete(str, objs);
	}
	
	*//**
	 * 删除单个
	 * @param str
	 * @param obj
	 * @return
	 * @throws Exception
	 *//*
	public int delete(String str, Object obj) throws Exception {
		return sqlSessionTemplate.delete(str, obj);
	}
	 
	public Object selectForObject(String str, Object obj) throws Exception {
		return sqlSessionTemplate.selectOne(str, obj);
	}

	public List selectForList(String str, Object obj) throws Exception {
		return sqlSessionTemplate.selectList(str, obj);
	}
	*//**
	 * 
	 * @Description:分页查询
	 * @author:chen
	 * @param str
	 * @param obj
	 * @param page
	 * @return List
	 * @date 2017-3-13
	 *//*
	public List selectInPage(String str, Object obj,Page page) throws Exception {
		 int offset = (page.getCurrpage()-1)*page.getSize();
		 int limit = offset+page.getSize();
		return sqlSessionTemplate.selectList(str, obj,new RowBounds(offset, limit));
	}
	
	public int save(String str, Object obj) throws Exception {
		return sqlSessionTemplate.insert(str, obj);
	}*/
}


